﻿using MvcShop.MVC.Handlers.Resources;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Web;
using MvcShop.MVC.Handlers;
using MvcShop.Core.Architecture.Configuration;

namespace MvcShop.MVC.Tests
{
    
    
    /// <summary>
    ///这是 ResourcesHandlerTest 的测试类，旨在
    ///包含所有 ResourcesHandlerTest 单元测试
    ///</summary>
    [TestClass()]
    public class ResourcesHandlerTest
    {

        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试属性
        // 
        //编写测试时，还可使用以下属性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///configuration 的测试
        ///</summary>
        [TestMethod()]
        public void configurationTest()
        {
            IConfigurationManager expected = new ConfigurationManagerWrapper(); // TODO: 初始化为适当的值
            ResourcesHandler target = new ResourcesHandler(expected); // TODO: 初始化为适当的值
            
            IConfigurationManager actual;
            target.configuration = expected;
            actual = target.configuration;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///ProcessRequest 的测试
        ///</summary>
        [TestMethod()]
        public void ProcessRequestTest()
        {
            ResourcesHandler target = new ResourcesHandler(new ConfigurationManagerWrapper()); // TODO: 初始化为适当的值
            HttpContext context = new HttpContext(new HttpRequest("resources.axd", "Http://localost:1957/resources.axd", "name=css"), new HttpResponse(new System.IO.StringWriter())); // TODO: 初始化为适当的值
            target.ProcessRequest(context);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }

        /// <summary>
        ///GetSetting 的测试
        ///</summary>
        [TestMethod()]
        [DeploymentItem("MvcShop.MVC.dll")]
        public void GetSettingTest()
        {
            IConfigurationManager configuration = null; // TODO: 初始化为适当的值
            string resourcesName = string.Empty; // TODO: 初始化为适当的值
            ResourcesElement expected = null; // TODO: 初始化为适当的值
            ResourcesElement actual;
            actual = ResourcesHandler_Accessor.GetSetting(configuration, resourcesName);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///GetResources 的测试
        ///</summary>
        [TestMethod()]
        [DeploymentItem("MvcShop.MVC.dll")]
        public void GetResourcesTest()
        {
            ResourcesHandler_Accessor target = new ResourcesHandler_Accessor(); // TODO: 初始化为适当的值
            HttpContextBase context = null; // TODO: 初始化为适当的值
            ResourcesElement setting = null; // TODO: 初始化为适当的值
            HandlerCacheItem_Accessor expected = null; // TODO: 初始化为适当的值
            HandlerCacheItem_Accessor actual;
            actual = target.GetResources(context, setting);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///ResourcesHandler 构造函数 的测试
        ///</summary>
        [TestMethod()]
        public void ResourcesHandlerConstructorTest()
        {
            ResourcesHandler target = new ResourcesHandler();
            Assert.Inconclusive("TODO: 实现用来验证目标的代码");
        }
    }
}
